/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>
#include <cstring>
using namespace std;

int main_1027_1()
{
    int R,G,B;
    scanf("%d %d %d",&R,&G,&B);
    char radix13[]="0123456789ABC";
    char R13[3]= {0},G13[3]={0},B13[3]={0};
    int idx=0;
    do
    {
        R13[idx++]=radix13[R%13];
        R/=13;
    }
    while (R);
    idx=0;
    do
    {
        G13[idx++]=radix13[G%13];
        G/=13;
    }
    while (G);
    idx=0;
    do
    {
        B13[idx++]=radix13[B%13];
        B/=13;
    }
    while (B);
    strlen(R13)<2?printf("#0%s",R13):printf("#%c%c",R13[1],R13[0]);
    strlen(G13)<2?printf("0%s",G13):printf("%c%c",G13[1],G13[0]);
    strlen(B13)<2?printf("0%s",B13):printf("%c%c",B13[1],B13[0]);
    return 0;
}
